<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <h:body>

        <h:form id="formMenu" >

            <p:menubar>  

                <p:menuitem value="Home " url="/home.jsf" icon="home" />  

                <p:submenu label="Cadastros" icon="adicionar">  

                    <p:menuitem value="Caixas" url="/caixas/" icon="caixa" />
                    <p:menuitem value="Cofres" url="/cofres/" icon="cofre" />

                    <p:separator/>

                    <p:menuitem value="Fornecedores" url="/fornecedores/" icon="fornecedor" />
                    <p:menuitem value="Clientes" url="/clientes/" icon="clientes" />
                    <p:menuitem value="Empresa" url="/empresas/" icon="empresa" />
                    <p:menuitem value="Usuários" url="/usuarios/" icon="usuarios" />

                    <p:separator/>

                    <p:menuitem value="Jogos" url="/jogos/" icon="jogos" />

                    <p:separator/>

                    <p:menuitem value="Tipos.Opera.Negociais" url="/tipos-operacoes-negociais/" icon="negocios" />


                </p:submenu> 

                <p:submenu label="Finanças " icon="financas">  

                    <p:menuitem value="Receitas" url="/receitas/" icon="receitas" />  
                    <p:menuitem value="Despesas" url="/despesas/" icon="despesas" />  

                    <p:separator/>

                    <p:submenu label="Movimentações" 
                               icon="movimentacao">  

                        <p:menuitem value="Caixas" url="/movimentacoes-caixas/" icon="caixa" />  
                        <p:menuitem value="Cofres" url="/movimentacoes-cofres/" icon="cofre" /> 

                    </p:submenu>  

                    <p:separator/>

                    <p:menuitem value="Ocorrência de Jogos" url="/movimentacoes-jogos/" icon="jogos" />

                    <p:separator/>

                    <p:menuitem value="Operaç. Negociáis" url="/operacoes-negociais/" icon="clientes" />

                </p:submenu>

                <p:menuitem value="Relatórios" 
                            icon="relatorios" 
                            oncomplete="dlgRelatorios.show()" 
                            update=":dialogRelatorios" />

                <p:menuitem value="Sair" 
                            icon="sair" 
                            oncomplete="logOut.show()"
                            />

            </p:menubar>

        </h:form>

        <p:dialog id="dialogRelatorios"
                  header="Relatórios"
                  widgetVar="dlgRelatorios"
                  modal="true"
                  appendTo="@(body)">

            <h:form  >

                <p:fieldset legend="Período" >

                    <h:panelGrid columns="4" 
                                 style="width: 100%" >

                        <h:panelGroup>

                            Data Inicial<br/>
                            <p:calendar size="15" 
                                        showOn="button" 
                                        locale="pt" 
                                        value="#{relatorioBean.dataInicial}" > 
                            </p:calendar>

                        </h:panelGroup>

                        <h:panelGroup>

                            Data Final<br/>
                            <p:calendar size="15" 
                                        showOn="button" 
                                        locale="pt" 
                                        value="#{relatorioBean.dataFinal}" > 
                            </p:calendar>

                        </h:panelGroup>

                    </h:panelGrid>

                </p:fieldset>

                <br/>

                <p:fieldset legend="Relatório" >

                    <p:selectOneMenu value="#{relatorioBean.relatorio}"
                                     style="width: 100%;" 
                                     required="true"
                                     requiredMessage="Informe o relatório que deseja imprimir!">

                        <f:selectItems value="#{relatorioBean.relatorios}" />

                        <p:ajax event="change" update="btnImprimir" />

                    </p:selectOneMenu>

                    <hr/>
                    <p:commandButton id="btnImprimir"
                                     value="Imprimir" 
                                     action="#{relatorioBean.imprimirRelatorio()}" 
                                     onclick="this.form.target = '_blank'"
                                     ajax="false" 
                                     disabled="#{relatorioBean.relatorio.nome.equals('Selecione')}" />

                </p:fieldset>

                <br/>

            </h:form>

        </p:dialog>

        <p:confirmDialog widgetVar="logOut" 
                         showEffect="fade" 
                         hideEffect="fade"
                         header="Dejesa sair?"
                         message="Deseja realmente sair?"
                         appendTo="@(body)" >  

            <h:form id="formLogOut" >

                <p:commandButton value="Sim"    
                                 styleClass="ui-confirmdialog-yes" 
                                 icon="ui-icon-check" 
                                 action="#{acessoBean.doLogOut()}" 
                                 ajax="false"/>

                <p:commandButton value="Não" 
                                 styleClass="ui-confirmdialog-no" 
                                 icon="ui-icon-close"  
                                 onclick="logOut.hide()" /> 

            </h:form>

        </p:confirmDialog>

    </h:body>
</html>

